package demo9Polymorphism;

/**
 * 抽象类
 * 抽象类无法实例化
 * 抽象类就是为了被继承
 * 当一个类继承抽象类是,它必须重写抽象方法
 */
abstract class Shape1{

    public Shape1(){
        System.out.println("构造方法!");
    }

    public abstract void graph();
}

class Circle1 extends Shape1{
    @Override
    public void graph() {
        System.out.println("⚪");
    }
}
class Fount1 extends Shape1{
    @Override
    public void graph() {
        System.out.println("♦");
    }
}
class Triangle1 extends Shape1{
    @Override
    public void graph() {
        System.out.println("▲");
    }
}

public class TestDemo1 {

    public static void drawMap(Shape1 shape1){
        shape1.graph();
    }

    public static void main(String[] args) {
        Circle1 circle1 = new Circle1();
        Fount1 fount1 = new Fount1();
        Triangle1 triangle1 = new Triangle1();
        drawMap(circle1);
        drawMap(fount1);
        drawMap(triangle1);
    }

}
